import { mapState } from 'vuex'
import toolList from '../data/toolList'
import dayjs from 'dayjs'
export default {
  data() {
    return {}
  },
  computed: {
    ...mapState({
      getTool(state) {
        return toolList[state.tool.category]
      }
    })
  },
  methods: {
    msgSuc(message = '') {
      this.$message.closeAll()
      this.$message({
        message,
        type: 'success',
        duration: 1500,
        offset: 40
      })
    },
    msgErr(message = '') {
      this.$message.closeAll()
      this.$message({
        message,
        type: 'error',
        duration: 1500,
        offset: 40
      })
    },
    msgWrg(message = '') {
      this.$message.closeAll()
      this.$message({
        message,
        type: 'warning',
        duration: 1500,
        offset: 40
      })
    },
    msgInfo(message = '') {
      this.$message.closeAll()
      this.$message({
        message,
        type: 'info',
        duration: 1500,
        offset: 40
      })
    },
    $dayjs(date) {
      return dayjs(date)
    }
  }
}
